const express = require("express");
const router = express.Router();
const { inStockCurrentComm, inStockTransacRecord, inStockTransacRobot, inStockAsset, leverBorrowing } = require("../../data/mockData.js");



// 查询交易表格数据（当前委托和历史委托）
router.get("/stock/current/commission", (req, res) => {
    //   console.log(req.query, "req");
    res.success({ data: inStockCurrentComm });
});

const { getBalance } = require('../units/index.js')

// 成交记录
router.get("/stock/transaction/record", async (req, res) => {
    //   console.log(req.query, "req");
    const data = await getBalance(req.query.address, req.query.page, req.query.size)

    res.success({ data: data.accountTransactions, message: `账户的交易数据查询成功！` });
});

// 交易机器人
router.get("/stock/transaction/robot", (req, res) => {
    //   console.log(req.query, "req");
    res.success({ data: inStockTransacRobot });
});

// 资产
router.get("/stock/asset", (req, res) => {
    //   console.log(req.query, "req");
    res.success({ data: inStockAsset });
});

// 借款管理
router.get("/stock/borrowing", (req, res) => {
    //   console.log(req.query, "req");
    res.success({ data: leverBorrowing });
});


module.exports = router;
